<doc>
<contents_area>
<div id="Content" style="padding: 5px;">
<h1><a name="PyDevLaunching-Launching%2FDebuggingPythonscripts"></a>Launching/Debugging Python scripts</h1>


<h1><a name="PyDevLaunching-RegularLaunch"></a>Regular Launch</h1>

<p>The easiest way of launching a python file from PyDev is opening an editor and using the <b>F9 keybinding</b>. Through that command, PyDev will create/reuse a <b>launch</b> config to run the current editor based on the <b>current settings of the project</b> (i.e.: if the project is configured as IronPython, it'll use an IronPython interpreter).</p>

<p><span class="image-wrap" style=""><img src="images/debugger/f9.png" style="border: 1px solid black" /></span><br/>
Another option would be running using the <b>context menu</b>, where you can choose how you want to make the run (in that way, you could run a python project with a jython interpreter)</p>

<p><span class="image-wrap" style=""><img src="images/debugger/run_as_regular.png" style="border: 1px solid black" /></span></p>
<h1><a name="PyDevLaunching-UnitTestLaunch"></a>Unit Test Launch</h1>

<p>If you use <b>unit-tests</b>, and want to run only a single unit-test or a few unit-tests of a module, you can use the <b>Ctrl+F9 keybinding</b>, which will open a tree where you can choose which test(s) you want to run:</p>



<p><span class="image-wrap" style=""><img src="images/debugger/ctrl_f9.png" style="border: 1px solid black" /></span><br/>
In that dialog, there are some options:</p>


<ul>
	<li>Extending the filter and pressing 'Enter' will run the filtered tests</li>
	<li>Explicitly selecting the class/tests to run will run those tests</li>
</ul>






<h1><a name="PyDevLaunching-DebugLaunch"></a>Debug Launch</h1>

<p>To run in debug mode, you can use the <b>context menu</b>, where you can choose how you want to make the debug (note that in that way, you could debug a python project with a jython interpreter)</p>

<p><span class="image-wrap" style=""><img src="images/debugger/run_as_debug.png" style="border: 1px solid black" /></span><br/>
Another option would be running the last launch in debug mode. See: `Rerun Last Launch (regular or debug mode)`_</p>




<h1><a name="PyDevLaunching-RerunLastLaunch%28regularordebugmode%29"></a>Rerun Last Launch (regular or debug mode)</h1>


<p>If you use the F9 and Ctrl+F9 keybindings or launch through the context menu, usually you'll also want to check the default eclipse preferences so that <b>Ctrl+F11</b> and <b>F11</b> will run your last configuration (otherwise, they'll bring a dialog to run/debug your current editor, which is mostly what's already given by PyDev through F9 and Ctrl+F9).</p>



<p>To do that, open the eclipse preferences (<b>window &gt; preferences</b>) and check <b>"Always launch previously launched application"</b>, that way, when you use <b>F11</b>, your last launch will be repeated in <b>debug mode</b> and with <b>Ctrl+F11</b>, it'll be relaunched in the <b>regular mode</b>.</p>


<p><span class="image-wrap" style=""><img src="images/debugger/launching_dialog.png" style="border: 1px solid black" /></span><br/>
Another option would be running the last launch from the menu. You can go to the menu with keybindings (<b>Alt+R, then 'T' regular run or 'H' for debug run</b>) and choose some existing launch to be run.</p>

<p><span class="image-wrap" style=""><img src="images/debugger/run_history.png" style="border: 1px solid black" /></span></p>
<h1><a name="PyDevLaunching-Debugging"></a>Debugging</h1>

<p>Currently the debugger supports:</p>

<ul>
	<li>Step in: <b>F5</b></li>
	<li>Step over: <b>F6</b></li>
	<li>Step return: <b>F7</b></li>
	<li>Continue: <b>F8</b></li>
	<li>Breakpoints (with optional condition)</li>
	<li>Stack view showing multiple threads</li>
	<li>Locals and Globals variable display</li>
	<li>Expressions display</li>
	<li>Temporary display for selection: <b>Ctrl+Shift+D</b></li>
	<li>Hover showing the selected expression evaluation</li>
</ul>




<p>To add breakpoints, you can double click the left bar or use Ctrl+F10 &gt; Add breakpoint. In a line with an existing breakpoint Ctrl+F10 will be able to remove the breakpoint, disable it and edit its properties (which can be used to provide conditions for the breakpoint to be hit). Double-clicking an existing breakpoint will remove it.</p>



<p>When you hit a breakpoint, you'll get a view that allows you to inspect the stack, see locals and globals, hover over variables (or select a text to be evaluated) and add expressions.</p>

<p><span class="image-wrap" style=""><img src="images/debugger/debug_perspective.png" style="border: 1px solid black" /></span><br/>
Note that the program output is displayed in the console, and the errors in the console are hyperlinked back to the file:</p>

<p><span class="image-wrap" style=""><img src="images/debugger/hyperlink.png" style="border: 1px solid black" /></span></p>
</div>
</contents_area>
</doc>